Xbasic

OBJECT.CHILD_ENUM Function

Syntax

.Child_Enum([C flags[,C classmap]])

Arguments

flags

Optional. Character

Flag Value
Description
"r"

Alpha Anywhere recurses into objects that have child objects. For example, Alpha Anywhere will enumerate all of the fields in an embedded browse, or sub-form.

"t"

Returns names of objects that have a tab stop. For example a field's label does not have a tab stop.

"p"

Returns object properties.

"px"

Returns only object properties with non-blank values.

"e=<expn>"

Returns the result of <expn>, rather than the object name. The alias "this" represents the object, and any object method can be used in <expn>. E.g. "e = this.FIELD_GET().FULLNAME_GET()" returns the field name that an object is bound to. Note : Remove all spaces from the expression.

"s"

Returns a list of the selected objects. (Only meaningful if the layout is in design mode.)

"d"

Returns the names of each member of a group. (Only meaningful if the layout is in design mode, and if used in conjunction with the "s" flag).

"n"

Returns the names in a CR-LF delimited list that is suitable for use in a tree control (i.e. colons in object names are replaced with period, and [ ] in array indexes are preceded with periods).

"f=class"

Returns only objects of the specified class. For example, if you specify a class of "calendar" all of the objects that are defined as "calendar" fields are enumerated. If you specify a class of "field" all of the field objects (including "calendar" which is derived from a "field" object) are enumerated. If you specify a class of "control" all controls are enumerated. For example to get a list of all fields and browse columns, specify "F=field,column". Class can contain a comma delimited list of class names. Note : Remove all spaces from the expression.

"c = n"

Returns the result in proper case (capital first letter, rest lower case).

"c = u"

Returns the data in all uppercase.

classmap

For internal use only.

Description

Return a CR-LF separated list of child objects.

Discussion

The <OBJECT>.CHILD_ENUM() method applies to:

Alpha Anywhere (for <OBJECT> use the keyword "A5")
Control Panel (for <OBJECT> use the keyword "CONTROLPANEL")
Browses (for <OBJECT> use either the <BROWSE> pointer or the name of the browse)
Forms (for <OBJECT> use either the <FORM> pointer or the name of the form)
Form Controls (for <OBJECT> use the <CONTROL> pointer or the address of the control)

The <OBJECT>.CHILD_ENUM() method returns a CR-LF separated list of all the child objects on the object, in tab order.

Example

The following code creates an array of all of the object names on the form. Fields in embedded browses and sub-forms are included. The full object name is returned because the .NAME() method is called with the argument of "16".

list = topparent.child_enum("r;e=this.name(16)")
count = w_count(list, CRLF())
dim object_array[count] as C
object_array.initialize(list)

This script run by the OnInit event of a form retrieves a list of embedded browses.

dim browse_list as C
browse_list = this.Child_Enum("f=browse")

A button on a form calls this script, which displays a message containing a list of the column names of the embedded browse named browse1.

ui_msg_box("Browse Columns", browse1.child_enum())

Limitations

Desktop applications only.

See Also